﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Practices.EnterpriseLibrary.Data;
using System.Data.Common;
using System.Data;

namespace DAL.BusinessDeal
{
    public class StContainerStatusDAL
    {
         public const string ST_CONTAINER_STATUS =
       @"select STS_CSTATUSCD , sts_remark from  st_container_status {0}";

         /// <summary>
         /// 获取船期
         /// </summary>
         /// <returns></returns>
         public DataTable GetTable(string textWhere, string orderText)
         {
             string query = string.Empty;
             if (!string.IsNullOrEmpty(textWhere))
                 query += "  where " + textWhere;
             if (!string.IsNullOrEmpty(orderText))
                 query += " order by " + orderText;
             return GetDataTable(string.Format(ST_CONTAINER_STATUS, query));
         }

         public DataTable GetDataTable(string sql)
         {
             Database db = DatabaseFactory.CreateDatabase();
             DbCommand dbCommand = db.GetSqlStringCommand(sql);
             DataTable dt = db.ExecuteDataTable(dbCommand);
             if (dt != null)
             {
                 dt.TableName = "st_container_status";
             }
             return dt;
         }
    }
}
